<?php
/**
 * ExtDatePickerBase class file
 *
 * @author TrueSoftware B.V. (The Netherlands)
 * @link http://www.ext4yii.com
 * @copyright Copyright 2007-2010 TrueSoftwareB.V. all rights reserved.
 * @license http://www.ext4yii.com/license/
 *          EVALUATION VERSION - NOT FOR COMMERCIAL USE OR DISTRIBUTION.
 * @version 0.7.2
 */
 
 
abstract class ExtDatePickerBase extends ExtComponent
{
    public function renderConfig($asobject=true)
    {
        if($this->getValue() != "")
        {
            if(trim($this->getFormat())=="")
                throw new Exception(Ext4Yii::t('ext4yii','DatePicker: Undefined date format! You need to specify the date format when setting the date value.'));

            $value = sprintf('Date.parseDate("%s","%s")',$this->getValue(),$this->getFormat());
            $this->setJavaScriptConfig('value',$value);
        }

        if(!is_null($this->parent) && ($this->parent instanceof ExtDateMenu))
        {
            $this->parent->mergeConfigs($this->getAllConfigs());
        }
        else
            return parent::renderConfig($asobject);
    }
}
?>
